package com.github.baichuan.web.security;

import org.springframework.util.DigestUtils;

import java.nio.charset.StandardCharsets;

/**
 * 使用MD5算法对密码进行加密
 */
public class Md5Encryption implements PasswordEncryption {
    @Override
    public String digest(String password, String salt) {
        String confused = password + "-" + salt;
        return DigestUtils.md5DigestAsHex(confused.getBytes(StandardCharsets.UTF_8));
    }
}
